package cn.stronglink.netrequest.business.inventory;

import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

import cn.stronglink.netrequest.util.HttpURL;
import cn.stronglink.netrequest.util.HttpUtil;
import okhttp3.Callback;

/**
 * Created by Tgb on 2018/6/14.
 * 盘点
 */

public class InventoryService {
    private Gson gson = new Gson();

    public void downloadInventoryWorkOrder(String userId, Callback callback) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        userId = gson.toJson(map);
        HttpUtil.httpPost(HttpURL.URL_INVENTORY_WORK_RODER, userId, callback);
    }

    public void uploadInventoryList(String json, Callback callback) throws Exception {
        HttpUtil.httpPost(HttpURL.URL_UPLOAD_INVENTORY_WORK_ORDER, json, callback);
    }

    public String downloadInventoryWorkOrder(String userId) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        userId = gson.toJson(map);
        return HttpUtil.httpPostAsync(HttpURL.URL_INVENTORY_WORK_RODER, userId);
    }

    public String uploadInventoryList(String json) throws Exception {
        return HttpUtil.httpPostAsync(HttpURL.URL_UPLOAD_INVENTORY_WORK_ORDER, json);
    }
}
